<template>
	<view>
		<u-empty v-if="list.length==0"></u-empty>
		<view class="u-border-top" v-else>
			<view class="list">
				<view class="item u-border-bottom" v-for="item in list" :key='item.id' @click="handleNavTo(item)">
					<view class="item_img_mg">
						<image class="img" :src="item.imgUrl" mode=""></image>
						<view class="msg_box">
							<view class="title">
								{{item.name}}
							</view>
							<view class="summary">
								{{item.msg}}
							</view>
						</view>
					</view>
					<view class="time">
						{{$u.timeFormat(item.time, 'yyyy年mm月dd日') }}
					</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		onLoad() {
			this.init()
		},
		data() {
			return {
				list: []
			};
		},

		methods: {
			handleNavTo(item) {
				uni.navigateTo({
					url: '/pages/chat/chat?businessId=' + item.id
				})
			},
			init() {
				this.$u.api.findMsgUserList().then(res => {
					console.log(res, '列表')
					this.list = res
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.list {


		.item {
			padding: 24rpx;
			width: 100%;
			display: flex;
			justify-content: space-between;

			.time {
				font-size: 24rpx;
				color: #ACACAC;
			}

			.item_img_mg {
				display: flex;

				.msg_box {
					height: 100rpx;
					display: flex;
					justify-content: space-between;
					flex-direction: column;

					.summary {
						color: #A2A2A2;
						font-size: 24rpx;

					}

					.title {
						font-size: 32rpx;
						color: #101010;
					}
				}

				.img {
					width: 100rpx;
					height: 100rpx;
					border-radius: 50%;
					margin-right: 24rpx;
				}
			}
		}
	}
</style>
